<?php

namespace app\common\model;

use think\model\relation\BelongsTo;

class GoodsSpec extends BaseModel
{
    public function goods(): BelongsTo
    {
        return $this->belongsTo(Goods::class);
    }

    public function unit()
    {
        return $this->belongsTo(GoodsUnit::class, 'unit_id');
    }

    // 获取规格信息
    public function getSpecInfo($specId)
    {
        return $this->where('id', $specId)->find();
    }

}